﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CRMSalesManagement.FrontPageShow
{
    public partial class NewList : System.Web.UI.Page
    {
        private static string newsType = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["type"] != null)
            {
                newsType = Request.QueryString["type"].ToString();
                //CommonSiteMap.setType(newsType);
                //CommonSiteMap.foreOrBack = true;
            }
            if (!IsPostBack)
            {
                int pageNum = 1;
                if (Request.QueryString["page"] != null)
                {
                    pageNum = int.Parse(Request.QueryString["page"]);
                }
                int total = 0;
                var newsDb =CRM.Business.NewList.ManageListNews(out total, pageNum, this.DataPage1.ShowRecordCount, newsType);
                if (newsDb != null)
                {
                    this.dlNewsList.DataSource = newsDb;
                    this.dlNewsList.DataBind();
                    if (this.DataPage1.TotalRecordCount == 0)
                    {
                        lblMessage.Text = "*暂无信息";
                        lblMessage.Visible = true;
                    }
                    else
                    {
                        lblMessage.Visible = false;
                    }
                }
                #region 控制分页控件
                CRM.Business.ShowPageDispaly.NewPageDispaly(this.DataPage1, pageNum, total);
                #endregion
            }
        }
    }
}